package com.example.admin.controller;

import com.example.admin.service.AdChannelService;
import com.usian.model.admin.dtos.AdChannelQuery;
import com.usian.model.admin.dtos.ChannelDto;
import com.usian.model.admin.pojos.AdChannel;
import com.usian.model.common.dtos.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.xml.ws.Response;


/**
 * @author lenovo
 */
@RestController
@Slf4j
@Api(tags = "频道接口文档")
public class ChannelController {
    @Autowired
    private AdChannelService adChannelService;
    @ApiOperation(nickname = "添加怕频道信息",value="添加频道信息")
    @PostMapping("apchannel/v1/add_adchannel")
    public ResponseResult addAdChannel(@RequestBody ChannelDto channelDto){
        return adChannelService.addAdChannel(channelDto);
    }
    @ApiOperation(nickname = "修改频道状态",value="修改频道状态")
    @PostMapping("apChannel/v1/update_adchannel_by_name")
    public ResponseResult updateAdChannel(String channelName){
        return adChannelService.deleteChannelByName(channelName);
    }
    @ApiOperation(nickname = "模糊查询频道信息",value="模糊查询频道信息")
    @PostMapping("apChannel/v1/query_adChannel")
    public ResponseResult queryAdChannel(@RequestBody AdChannelQuery adChannelQuery){
        return adChannelService.queryAdChannel(adChannelQuery);
    }
    @PostMapping("apSensitive/v1/add_apSensitive")
    @ApiOperation(nickname = "添加敏感词",value = "添加敏感词")
    public ResponseResult addSenticty(String name){
        int i =1/0;
        return adChannelService.addSenticty(name);
    }
    @PostMapping("apSensitive/v1/get_all_list")
    @ApiOperation(nickname = "查看所有的敏感词",value="查看所有的敏感词")
    public ResponseResult getAllList(){
        return adChannelService.getAll();
    }
}
